package org.ucn.dmaa0914.temadesign.group2.tuiLayer;


/**
 * Write a description of class MainMenu here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class MainMenu extends Menu
{
    private int entryPerson;
    private int entryLoan;
    private int entryDvd;
    private int entryCopy;
    
    /**
     * Constructor for objects of class MainMenu
     */
    public MainMenu()
    {
        super(null, "Main Menu");
        
        entryPerson = addEntry("Person Menu");
        entryLoan = addEntry("Loan Menu");
        entryDvd = addEntry("DVD Menu");
        entryCopy = addEntry("Copy Menu");
    }

    public void handleEntry(int entryIndex)
    {
        super.handleEntry(entryIndex);
        
        if( entryIndex == entryPerson )
        {
            Application.instance.setCurrentMenu(new PersonMenu(this));
        }
        
        if( entryIndex == entryLoan )
        {
            Application.instance.setCurrentMenu(new LoanMenu(this));
        }
        
        if( entryIndex == entryDvd )
        {
            Application.instance.setCurrentMenu(new DvdMenu(this));
        }
        
        if( entryIndex == entryCopy )
        {
            Application.instance.setCurrentMenu(new CopyMenu(this));
        }
    }
}
